package thread;
public class threadDeom2 {
    public static void main(String[] args) {
        //Runnable runnable=new mythread1();
        //实现runnable接口
        //Thread t=new Thread(new mythread1());
        mythread1 mythread1=new mythread1();
        Thread t=new Thread(mythread1);
        t.start();
        while (true){
            System.out.println("这是主线程");
            try {
                Thread.sleep(1000);
            }catch (InterruptedException e){
                throw new RuntimeException();
            }
        }
    }
}
class mythread1 implements Runnable{
    @Override
    public void run() {
        while (true){
            System.out.println("这是实现接口线程");
            try {
                Thread.sleep(1000);
            }catch (InterruptedException e){
                throw new RuntimeException();
            }
        }
    }
}
